﻿/*******************************************************************************
 * Copyright @ 2017 YunSpace.Framework 版权所有
 * Author: GaoTang
 * Description: YunSpace 快速开发平台
 * Website：http://www.yunspace.com.cn
*********************************************************************************/
#region USING SYSTEM
using System.Collections.Generic;
using YunSpace.Data;
using YunSpace.Domain.Entity.MiniSite;
using YunSpace.Domain.IRepository.MiniSite;
#endregion

namespace YunSpace.Repository.MiniSite
{
    public class SiteActivityRepository : RepositoryBase<SiteActivityEntity>, ISiteActivityRepository
    {
        public List<string> GetTop5SiteActivityMost()
        {
            /// SELECT so.F_SiteId
            ///     FROM MiniSite_SiteOrder so 
            ///     GROUP BY so.F_SiteId 
            ///     ORDER BY COUNT(so.F_SiteId) DESC
            ///     LIMIT 0, 5
            string sqlStr = @"select a.F_Id from MiniSite_SiteActivity a  left join MiniSite_SiteOrder b 
                              on a.F_OrderId=b.F_Id group by a.F_Id order by count(a.F_Id) desc limit 0,5";

            return GetColumnList<string>(sqlStr);
        }
    }
}

